
$(function (){
	$("#name").change(function (val){
		if(val.target.selectedIndex == 2) $("#timePeriod").val('T2');
		else $("#timePeriod").val('T1');
	})
	$("#name").val($("#state").val());
})
layui.use(['laydate','xmSelect'],function (){
	var laydate = layui.laydate;
	var xmSelect = layui.xmSelect;

	laydate.render({
		elem: '#startTime'
		,type: 'datetime'
	});
	laydate.render({
		elem: '#endTime'
		,type: 'datetime'
	});


})
function save() {
	// validateRule();

	if (!$("#name").val()) {
		layer.msg('请输入赛场名')
		return false;
	}

	if (!$("#startTime").val()) {
		layer.msg('请选择考试开始时间')
		return false;
	}

	if (!$("#endTime").val()) {
		layer.msg('请选择考试结束时间')
		return false;
	}

	$.ajax({
		cache: true,
		type: "POST",
		url: "/jzweb/examinationBatchCom/updates",
		data: $('#signupForm').serialize(),// 你的formid
		async: false,
		error: function (request) {
			parent.layer.alert("Connection error");
		},
		success: function (data) {
			if (data.code == 0) {
				parent.layer.msg("操作成功");
				parent.reLoad();
				var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
				parent.layer.close(index);

			} else {
				parent.layer.alert(data.msg)
			}

		}
	});
}